﻿$(document).ready(function (e) {
    $(".branddspage p").each(function (index, element) {
        if (index % 2 == 1) {
            $(this).addClass("mod2")
        }
        if (index % 3 == 2) {
            $(this).addClass("mod3")
        }
        if (index % 4 == 3) {
            $(this).addClass("mod4")
        }
    });

    var CurcspageCli = 0;
    var AboutpageLeng = $(".AboutpageCli").length;
    var AboutpageWid = $(".AboutpageC").width();
    arrowsBTn();
    curenTclasanit();
    $(".AboutpageCli").each(function (index, element) {
        $(this).css("z-index", 100 + index);
        $(this).css({ left: (index - CurcspageCli) * AboutpageWid })
    });


    function curenTclasanit() {
        $(".AboutpageCnav a").removeClass("curnanvsx").eq(CurcspageCli).addClass("curnanvsx");


    }

    $(".AboutpageCnav a").click(function () {
        CurcspageCli = $(".AboutpageCnav a").index(this);
        $(".AboutpageCli").each(function (index, element) {
            $(this).animate({ left: (index - CurcspageCli) * AboutpageWid }, 500, "easeInOutCubic")
        });
        arrowsBTn();
        curenTclasanit();
    })


    $(".AboutpageL").click(function () {
        if (CurcspageCli > 0) {
            CurcspageCli--;
            $(".AboutpageCli").each(function (index, element) {
                $(this).animate({ left: (index - CurcspageCli) * AboutpageWid }, 500, "easeInOutCubic")
            });
        }
        arrowsBTn();
        curenTclasanit();
    })
    $(".AboutpageR").click(function () {
        if (CurcspageCli < AboutpageLeng - 1) {
            CurcspageCli++;
            $(".AboutpageCli").each(function (index, element) {
                $(this).animate({ left: (index - CurcspageCli) * AboutpageWid }, 500, "easeInOutCubic")
            });
        }
        arrowsBTn();
        curenTclasanit();
    })

    navLinkresez();
    function navLinkresez() {
        var heights = $(".AboutpageCnav").height();
        var heigtsx = $(".AboutpageCnav a").height();
        var shuxleng = $(".AboutpageCnav a").length;
        $(".AboutpageCnav a").css("margin-bottom", heights * 0.02);
        $(".AboutpageCnav a").eq(0).css("margin-top", (heights - heigtsx * shuxleng - heights * 0.02 * shuxleng) / 3)


    }



    $(window).resize(function () {
        AboutpageWid = $(".AboutpageC").width();
        $(".AboutpageCli").each(function (index, element) {
            $(this).css({ left: (index - CurcspageCli) * AboutpageWid })
        });
        navLinkresez();
    })
    function arrowsBTn() {
        $(".AboutpageL,.AboutpageR").removeClass("AboutpageBtnhui");
        if (CurcspageCli == 0) {
            $(".AboutpageL").addClass("AboutpageBtnhui");
        }
        if (CurcspageCli == AboutpageLeng - 1) {
            $(".AboutpageR").addClass("AboutpageBtnhui");
        }
    }








    /////////////手势滑动///////////
    /*  $("#container").on("swipeleft",function(){
    swipelefthdl();
    });
    $("#container").on("swiperight",function(){
    swiperighthdl();
    });*/


})